package eu.webmedia.recruitment.comics.preferences;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class Preferences {

	private Collection<String> stripNames;
	
	public Preferences() {}
	
	public Preferences(Collection<String> stripNames) {
		this.stripNames = stripNames;
	}

	public Collection<String> getStripNames() {
		return stripNames;
	}
	
	public void setStripNames(Collection<String> stripNames) {
		this.stripNames = stripNames;
	}

	
	public Collection<String> getDeleted(Preferences newPreferences) {
		List<String> deleted = new ArrayList<String>();
		
		for (String name : stripNames) {
			if (!newPreferences.getStripNames().contains(name)) {
				deleted.add(name);
			}
		}
		
		return deleted;
	}

	public Collection<String> getAdded(Preferences newPreferences) {
		List<String> added = new ArrayList<String>();
		
		for (String name : newPreferences.getStripNames()) {
			if (!stripNames.contains(name)) {
				added.add(name);
			}
		}
		
		return added;
	}

	public boolean contains(String stripName) {
		return stripNames.contains(stripName);
	}

}
